<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ page import="entity.User,java.util.List,dao.UserDAO" %>
<!--day04配套-->
<!--把美工做好的静态网页html改为jsp,然后在里面写JSP代码 把美工的3部分逻辑分区拆开成了header.jsp footer.jsp和本文件-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>listUsers</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="css/style.css" />
	</head>
	<body>
		<div id="wrap">
			<div id="top_content"> 
				<%@include file="header.jsp"  %>
				<div id="content">
					<p id="whereami">
					</p>
					<h1>
						用户列表
					</h1>
					<table class="table">
						<tr class="table_header">
							<td>ID</td>
							<td>用户名</td>
							<td>邮箱</td>
							<td>电话</td>
							<td>操作</td>
						</tr>
						
						<%
													UserDAOImpl dao = new UserDAOImpl();
																										List<User2> users = dao.findAll();
																										for(int i=0;i<users.size();i++){
																											User2 user = users.get(i);
																											System.out.println(user);
												%>
							<tr class="row<%=i%2+1 %>">
							<td>
								<%=user.getId() %>
							</td>
							<td>
								<%=user.getUsername() %>
							</td>
							<td>
								<%=user.getEmail() %>
							</td>
							<td>
								<%=user.getPhone() %>
							</td>
							<td>
								<a href="delUser4?id=<%=user.getId() %>">删除</a>&nbsp;
							</td>
							</tr>
							<% 
						}
						%>
						
						
					</table>
					<p>
						<input type="button" class="button" value="添加用户" onclick="location='addUser4.html'"/>
					</p>
				</div>
			</div>
			<%@include file="footer.jsp" %>
		
	</body>
</html>
